#include<linux/module.h>
#include<linux/timer.h>
#include<linux/jiffies.h>

struct timer_list mytimer;

static void myfunc(unsigned long data)
{
    printk("%s,time(secs)=%ld\n",(char *)data,jiffies/HZ);
    
    mod_timer(&mytimer,jiffies+1*HZ);
}

static int __init mytimer_init(void)
{
    printk(KERN_INFO"init timer..\n");
    
    setup_timer(&mytimer,myfunc,(unsigned long)"my timer!");
    
    mytimer.expires = jiffies + 1*HZ;
    
    add_timer(&mytimer);
    
    return 0;
}

static void __exit mytimer_exit(void)
{
    printk(KERN_INFO"del timer..\n");
    
    del_timer(&mytimer);
    
    return ;
}

module_init(mytimer_init);
module_exit(mytimer_exit);
MODULE_LICENSE("GPL");